package com.cx.tran1.controller;

import com.cx.tran1.feign.Tran2FeignService;
import com.cx.tran1.service.Tran1Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Trans1Controller {
    @Autowired
    private Tran1Service tran1Service;

    @Autowired
    private Tran2FeignService feignService;


    @RequestMapping("/add/{p}")
    public String test1(@PathVariable String p){
        tran1Service.addTest(p);
        return "ok";
    }

    @RequestMapping("/update/{id}/{p}")
    public String test2(@PathVariable String p,@PathVariable Long id){
        tran1Service.updateTest(p,id);
        return "ok";
    }


    @RequestMapping("/feign/add/{p}")
    public String feignTest1(@PathVariable String p){
        return feignService.add(p,"");
    }

}
